<?php
/**
 * Created by PhpStorm.
 * User: jocky
 * Date: 2017/6/2
 * Time: 下午2:41
 */
?>
<div class="login_wrapper">
    <div class="animate form login_form">
        <section class="login_content">
            <form id="login" style="padding: 0 5px;">
                <h1>账 户 登 录 </h1>
                <div class="form-group">
                    <input name="clientSN" type="text" class="form-control" placeholder="客户编号"
                           value="<?= $clientSN; ?>" data-error="客户编号不能为空"/>
                </div>
                <div class="form-group">
                    <input name="password" type="password" class="form-control" placeholder="密 码" data-error="密码不能为空"/>
                </div>

                <div class="form-group">
                    <?php
                    echo \yii\captcha\Captcha::widget([
                        'name' => 'captcha',
                        'captchaAction' => 'login/captcha',
                        'template' => '{input}{image}',
                        'options' => [
                            'class' => 'form-control pull-left',
                            'style' => 'width: 68%;',
                            'placeholder' => "图片验证码",
                            'data-error' => '验证码不能为空',
                            'maxlength' => 4
                        ],

                        'imageOptions' => [
                            'id' => 'captchaImg2',
                            'alt' => '验证码',
                            'title' => '点击刷新',
                            'class' => 'pull-right',
                            'style' => 'width:30%;height:45px;cursor:pointer;border: solid 1px #dedede;',
                            'onclick' => 'getNewCaptcha(2)',
                        ]
                    ]);
                    ?>
                    <div class="clearfix"></div>
                </div>
                <!--
                <div class="form-group text-left">
                    <input type="checkbox" name="user_agreement" checked/>
                    我已阅读并同意
                    <a href="javascript:void(0)" onclick="getUserAgreement()" target="_blank" tabindex="-1">
                        《用户协议》
                    </a>
                </div>
                -->
                <div class="form-group">
                    <button type="button" class="form-control btn btn-primary" id="loginBtn" onclick="sendLogin()">
                        登 录
                    </button>
                </div>

<!--                <div class="form-group pull-right">
                    没有帐号？
                    <a href="/reg" class="to_register" tabindex="-1"> 注册 </a>
                </div> -->
                <div class="clearfix"></div>
                <div><p style="font-size: 15px;">尊敬的客户，为了更好的体验请使用谷歌浏览器或者火狐浏览器打开本系统。</p></div>
                <div><a href="https://www.google.cn/chrome/"><strong style="font-size:12px; color: red;">谷歌浏览器</strong>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="https://download-ssl.firefox.com.cn/releases-sha2/stub/official/zh-CN/Firefox-latest.exe"><strong style="font-size: 12px; color: red;">火狐浏览器</strong></div>

                <div class="separator">
                    <div style="margin-top: 20px;">
                        <p>
                            Copyright © 2018-<?= date('Y'); ?> All Rights Reserved
                        </p>
                    </div>
                </div>

                <?php
                echo \yii\helpers\Html::hiddenInput(
                    Yii::$app->request->csrfParam,
                    Yii::$app->request->getCsrfToken()
                );
                ?>
            </form>
        </section>
    </div>
</div>

<script type = "text/javascript" >
    window.onload=function(){
        var BrowserMatch = {
        init: function() {
            this.browser = this.getBrowser().browser || "An Unknown Browser";
            this.version = this.getBrowser().version || "An Unknown Version";
            this.OS = this.getOS() || "An Unknown OS";
        },
        getOS: function() {
            if (navigator.platform.indexOf("Win") != -1) return "Windows";
            if (navigator.platform.indexOf("Mac") != -1) return "Mac";
            if (navigator.platform.indexOf("Linux") != -1) return "Linux";
            if (navigator.userAgent.indexOf("iPhone") != -1) return "iPhone/iPod";
        },
        getBrowser: function() {
            var rMsie = /(msie\s|trident\/7)([\w\.]+)/;
            var rTrident = /(trident)\/([\w.]+)/;
            var rFirefox = /(firefox)\/([\w.]+)/;
            var rOpera = /(opera).+version\/([\w.]+)/;
            var rNewOpera = /(opr)\/(.+)/;
            var rChrome = /(chrome)\/([\w.]+)/;
            var rSafari = /version\/([\w.]+).*(safari)/;
            var ua = navigator.userAgent.toLowerCase();
            var matchBS, matchBS2;
            matchBS = rMsie.exec(ua);
            if (matchBS != null) {
                matchBS2 = rTrident.exec(ua);
                if (matchBS2 != null) {
                    switch (matchBS2[2]) {
                        case "4.0":
                            return {
                                browser:
                                    "IE",
                                version: "8"
                            };
                            break;
                        case "5.0":
                            return {
                                browser:
                                    "IE",
                                version: "9"
                            };
                            break;
                        case "6.0":
                            return {
                                browser:
                                    "IE",
                                version: "10"
                            };
                            break;
                        case "7.0":
                            return {
                                browser:
                                    "IE",
                                version: "11"
                            };
                            break;
                        default:
                            return {
                                browser:
                                    "IE",
                                version: "Undefined"
                            };
                    }
                } else {
                    return {
                        browser: "IE",
                        version: matchBS[2] || "0"
                    };
                }
            }
            matchBS = rFirefox.exec(ua);
            if ((matchBS != null) && (!(window.attachEvent)) && (!(window.chrome)) && (!(window.opera))) {
                return {
                    browser: matchBS[1] || "",
                    version: matchBS[2] || "0"
                };
            }
            matchBS = rOpera.exec(ua);
            if ((matchBS != null) && (!(window.attachEvent))) {
                return {
                    browser: matchBS[1] || "",
                    version: matchBS[2] || "0"
                };
            }
            matchBS = rChrome.exec(ua);
            if ((matchBS != null) && ( !! (window.chrome)) && (!(window.attachEvent))) {
                matchBS2 = rNewOpera.exec(ua);
                if (matchBS2 == null) {
                    return {
                        browser: matchBS[1] || "",
                        version: matchBS[2] || "0"
                    };
                } else {
                    return {
                        browser: "Opera",
                        version: matchBS2[2] || "0"
                    };
                }
            }
            matchBS = rSafari.exec(ua);
            if ((matchBS != null) && (!(window.attachEvent)) && (!(window.chrome)) && (!(window.opera))) {
                return {
                    browser: matchBS[2] || "",
                    version: matchBS[1] || "0"
                };
            }
        }
    };
    BrowserMatch.init();
    // alert("当前浏览器为" + BrowserMatch.browser +"\n版本为:"+ BrowserMatch.version + "\n所处操作系统为"+BrowserMatch.OS);
    if (BrowserMatch.browser=="IE"){
        alert("当前浏览器为"+BrowserMatch.browser +"  ,请使用谷歌或者火狐浏览器");
        $(".form-control").attr("disabled","disabled");
    }
    }
</script>